﻿<div bsModal #createTenantModal="bs-modal" class="modal fade" (onShown)="onShown()" tabindex="-1" role="dialog" aria-labelledby="createUserModal" aria-hidden="true" [config]="{backdrop: 'static'}">
    <div class="modal-dialog">

        <div #modalContent class="modal-content">

            <form *ngIf="active" #createTenantForm="ngForm" novalidate (ngSubmit)="save()">

                <div class="modal-header">
                    <button type="button" class="close" (click)="close()" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                    <h4 class="modal-title">
                        <span>{{l("CreateNewTenant")}}</span>
                    </h4>
                </div>

                <div class="modal-body">
                    <div class="form-group form-float">
                        <div class="form-line">
                            <input class="form-control" type="text" name="TenancyName" [(ngModel)]="tenant.tenancyName" required maxlength="64" minlength="2">
                            <label class="form-label">{{l("TenancyName")}}</label>
                        </div>
                    </div>
                    <div class="form-group form-float">
                        <div class="form-line">
                            <input type="text" name="Name" class="form-control" [(ngModel)]="tenant.name" required maxlength="128">
                            <label class="form-label">{{l("Name")}}</label>
                        </div>
                    </div>
                    <div class="form-group form-float">
                        <div class="form-line">
                            <input type="text" name="ConnectionString" class="form-control" [(ngModel)]="tenant.connectionString" maxlength="1024">
                            <label class="form-label">{{l("DatabaseConnectionString")}} ({{l("Optional")}})</label>
                        </div>
                    </div>
                    <div class="form-group form-float">
                        <div class="form-line">
                            <input type="email" name="AdminEmailAddress" class="form-control" [(ngModel)]="tenant.adminEmailAddress" required maxlength="256" pattern="^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{1,})+$">
                            <label class="form-label">{{l("AdminEmailAddress")}}</label>
                        </div>
                    </div>
                    <p>{{l("DefaultPasswordIs","123qwe")}}</p>
                </div>

                <div class="modal-footer">
                    <button [disabled]="saving" type="button" class="btn btn-default" (click)="close()">{{l("Cancel")}}</button>
                    <button type="submit" class="btn btn-primary blue" [disabled]="!createTenantForm.form.valid || saving">{{l("Save")}}</button>
                </div>

            </form>

        </div>
    </div>
</div>